package gov.dhs.cis.soa.data;

import gov.dhs.cis.soa.Constants;
import gov.dhs.cis.soa.Utils;
import gov.dhs.cis.soa.Constants.EntityType;

import java.sql.Timestamp;


public class InfrastructureLS extends AbstractSOAData {
	public static final String STEREO_TYPE = "Logical Server";
	public int id;
	public String name;
	public String intHostConfig;
	public transient String descText;
	public String lsType;
	public String hwVendor;
	public String hw;
	public String product;
	public String osVendor;
	public String os;
	public String version;
	public String release;
	public String supSecCap;
	public String intSecCap;
	public transient String designAspects;

//	public transient List<IntegrationComp> intHostConfigList = null;
//	public transient List<SecurityComp> supSecCapList = null;
//	public transient List<SecurityComp> intSecCapList = null;
	
	public transient Timestamp createdDt = new Timestamp(System.currentTimeMillis());
	public Description desc;

	@Override
	public String toString() {
		String ret = "InfrastructureLS [id=" + id + ", name=" + name + ", Desc = " + desc + "] ";
		return ret;
	}
	
	public void createDescription() {
		StringBuffer txt = new StringBuffer();
		if(Utils.isEmpty(descText))
			descText = "";
		txt.append(Constants.NL+"Description = " + descText);
		if(Utils.isEmpty(designAspects))
			designAspects = "";
		txt.append(Constants.NL+"Design Aspects = " + designAspects);
		
		desc = Utils.prepareDescObj(txt.toString(), EntityType.INFLS);
	}
	/*
	public void addHostIntegrationComp(IntegrationComp intComp) {
		if(intComp == null)
			return;
		if(intHostConfigList == null)
			intHostConfigList = new ArrayList<IntegrationComp>();
		intHostConfigList.add(intComp);
	}
	
	public void addSupportedSecCap(SecurityComp sc) {
		if(sc == null)
			return;
		if(supSecCapList == null)
			supSecCapList = new ArrayList<SecurityComp>();
		supSecCapList.add(sc);
	}
	
	public void addIntegratedSecCap(SecurityComp sc) {
		if(sc == null)
			return;
		if(intSecCapList == null)
			intSecCapList = new ArrayList<SecurityComp>();
		intSecCapList.add(sc);
	}
	*/
	
//	public static String getUMLId(int entityId) {
//	return EntityType.INFLS + "_" + entityId;
//}

	@Override
	public long getId() {
		return id;
	}
	@Override
	public String getHashableId() {
		return name;
	}

	@Override
	public EntityType getUMLType() {
		return EntityType.INFLS;
	}
}

